//
//  EnvironmentPage.swift
//  chat
//
//  Created by 1 on 2023/4/6.
//

import SwiftUI

struct EnvironmentPage: View {
    @State var testEnvironment1 = UserDefaults.standard.bool(forKey: testEnvironment)
    var body: some View {
        VStack(spacing: 40){
            Spacer()
            Button {
                testEnvironment1 = false
                UserDefaults.standard.set(testEnvironment1, forKey: testEnvironment)
                AIUserAccount.cleanAccount()
            } label: {
                if(!testEnvironment1){
                    Text("正式").foregroundColor(.red)
                }else{
                    Text("正式").foregroundColor(.white)
                }
            }
            
            Button {
                testEnvironment1 = true
                UserDefaults.standard.set(testEnvironment1, forKey: testEnvironment)
                AIUserAccount.cleanAccount()
            } label: {
                if(testEnvironment1){
                    Text("测试").foregroundColor(.red)
                }else{
                    Text("测试").foregroundColor(.white)
                }
            }
            
            Text("改完重启,账户重登").foregroundColor(.yellow)
            
            Spacer()
        }
        .background(MBAColor.com_background.color)
    }
}

struct EnvironmentPage_Previews: PreviewProvider {
    static var previews: some View {
        EnvironmentPage()
    }
}
